<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\search\SysSourceSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Sys Sources');
$this->params['breadcrumbs'][] = $this->title;
?>
  <div class="layui-fluid">
    <div class="layui-card p30">		
		<div class="border-b pb15 f22">店铺</div>
		<div class="layui-row layui-col-space20 mt15">
            <div class="layui-col-xs12">
				<form class="layui-form " action="/admingoods/default/index">	
					<div class="layui-form-item">
					  <div class="layui-inline">
                                                <label class="layui-form-label">店铺名称</label>
                                                <div class="layui-input-inline">
                                                  <input type="text" name="name" value="<?=$condition['name']?>" placeholder="请输入店铺名称!" class="layui-input">
                                                </div>
					  </div>
					  <div class="layui-inline">
						<label class="layui-form-label">用户ID</label>
						<div class="layui-input-inline">
						  <input type="text" name="userid" value="<?=$condition['userid']?>" placeholder="请输入用户ID!" class="layui-input">
						</div>
					  </div>
					  <div class="layui-inline">
					   <button class="layui-btn layui-btn-normal layui-icon layui-icon-search">  搜索</button>
					  </div>
					</div>
					
					
				</form>
			</div>
		</div>
		
		<div class="layui-card-body p0 mt15">			
			<table class="layui-table">					
				<thead>
					<tr>
					  <th>ID</th>
					  <th>店铺名称</th>
					  <th>店铺区域</th>
					  <th>店铺地址</th>
					  <th>用户信息</th>
					  <th>联系人</th>
					  <th>联系电话</th>
					  <th>店铺状态</th>
					  <th>操作</th>
					</tr> 
				</thead>
			  <tbody>
				<?php foreach($data['storedata'] as $store){?>  
				
				<tr>
				  <td><?= $store['id'] ?></td>
				  <td><?= $store['name'] ?></td>
				  <td><?= $store['province']?>-<?= $store['city']?>-<?= $store['county']?></td>
				  <td><?= $store['address'] ?></td>
				  <td><?= $store['username'] ?>（<?= $store['userid'] ?>）</td>
				  <td><?= $store['liaison'] ?></td>
				  <td><?= $store['liaison_mobile'] ?></td>
                                    <td>	  <span class="layui-badge layui-bg-green">
					  	<?= $status_arr[$store['status']] ?>
					  </span>
				  </td>
				  <td>
					<?php if($store['status']==0){ //已下架的商品才能编辑?>
                                      <a class="layui-btn layui-btn-xs store-auth" href="/adminstore/default/auth?id=<?= $store['id']?>">审核</a>
					<?php }?>
                                        <a class="layui-btn layui-btn-danger layui-btn-xs " data-id="<?= $store['id']?>" ><i class="layui-icon layui-icon-delete"></i>查看</a>
                                </td>
				</tr>
				<?php }?>
				</tbody>
			</table>
			
			<div class="p-tradelist-pager text-c"><?= $page?></div>		
		</div>
    </div>
  </div>
<script>
$(".onsale").on('click',function(){
    var goods_id = $(this).attr('data-id');
    layer.confirm('您确定要删除该条数据', {btn: ['删除', '取消' ]}, function(index, layero){
        $params = JSON.stringify({'status':1,'goods_id':goods_id});
        onsale_back = ajaxSynchroRequest("/adminstore/default/delete",$params);
        if(onsale_back.success==1){
            layer.msg(onsale_back.msg);
            layer.close(index);
            window.location.reload();
        }
    });
});

</script>

